class Subscribe {

  constructor (){

  }

  handlers = {};

  addEventListener(type,handler){
    if(!(type in this.handlers)){
      this.handlers[type]=[];
    }
    this.handlers[type].push(handler);
  }

  dispatchEvent(type,...params){
    if(!(type in this.handlers)){
      return null
    }

    this.handlers[type].forEach(handler=>{
      handler(...params);
    })
  }
}
